package cn.gao.enums.child;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: GaoXu
 * @Date: 2022/05/20/15:48
 * @Description:
 */
public enum ImgTypeEnum {

    PNG("png"),
    JPG("jpg"),
    JPEG("jpeg"),
    ICO("ico"),
    ICON("icon"),
    BMP("bmp"),
    SVG("svg"),
    PSD("psd"),
    WEBP("webp"),
    GIF("gif"),
    RAW("raw"),
    ;

    private String typeName;

    ImgTypeEnum (String typeName){
        this.typeName = typeName;
    }

    public static boolean contains(String type){
        AtomicBoolean flag = new AtomicBoolean(false);
        Arrays.stream(ImgTypeEnum.values()).forEach(e->{
            if (StringUtils.equals(type,e.typeName)){
                flag.set(true);
            }
        });
        return flag.get();
    }
}
